package com.winona.ui;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageButton;
import android.widget.TextView;

import com.taplinker.client.R;
import com.winona.Base1Activity;
import com.winona.HomeActivity;

@SuppressLint("ResourceAsColor")
public class ConversationActivity extends Base1Activity implements
		OnClickListener {
	private ImageButton back;
	private TextView title, doctor, patient;
	private Intent intent;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.conversation);
		findView();
		 Animation animRef = AnimationUtils.loadAnimation(this, R.anim.anim1);
		back.setOnClickListener(this);
		doctor.setOnClickListener(this);
		patient.setOnClickListener(this);

	}

	private void findView() {
		back = (ImageButton) findViewById(R.id.conver_back);
		title = (TextView) findViewById(R.id.conver_title);
		doctor = (TextView) findViewById(R.id.conver_doctor);
		patient = (TextView) findViewById(R.id.conver_patient);
		title.setText("我的会话");
	}

	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.conver_back:

			intent = getIntent();
			String value = intent.getExtras().getString("conversation");
			if (value.equals("0")) {
				openMenu();
			} else {
				intent = new Intent(ConversationActivity.this,
						HomeActivity.class);
				startActivity(intent);
				overridePendingTransition(R.anim.input, R.anim.out);
			}
			break;
		case R.id.conver_patient:
			patient.setBackgroundResource(R.drawable.asklight);
			doctor.setBackgroundResource(R.drawable.asknormal);
			patient.setTextColor(R.color.red);
			doctor.setTextColor(R.color.white);
			// patient.setVisibility(View.VISIBLE);
			// doctor.setVisibility(View.INVISIBLE);
			break;
		case R.id.conver_doctor:
			doctor.setBackgroundResource(R.drawable.asklightright);
			patient.setBackgroundResource(R.drawable.asknormalleft);
			doctor.setTextColor(R.color.red);
			patient.setTextColor(R.color.white);
			// patient.setVisibility(View.INVISIBLE);
			// doctor.setVisibility(View.VISIBLE);
			break;

		default:
			break;
		}
	}

}
